// import c from '../store/c.js';嵌套
export default {
  namespaced: true,//加了命名空间，就不会全触发
  state: { age1: 12, name: 'aaa' },
  // state: ()=>({ age1: 12,name:'aaa' }),函数写法
  mutations: {
    syncChange(state, payload) {
      console.log('a-syncChange')
      state.age1 += payload
    }
  },
  modules: {
    //c,
    c: {
      namespaced: true,//加了命名空间，就不会全触发
      state: { age2: 100 },
      getters: {
        profile(state) { return state.age2 } // -> getters['account/profile']
      },
      mutations: {
        changeAge(state, payload) {
          state.age2 += payload
        },
        syncChange() {
          console.log('c-syncChange')
        }
      },
      modules: {
        d: {
          namespaced: true,//加了命名空间，就不会全触发
          state: { age3: 200 },
          mutations: {
            syncChange() {
              console.log('d-syncChange')
            }
          }
        }
      }
    }
  }
}